<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Treeview Test</title>
<link rel="stylesheet" type="text/css" href="../lib/jqueryui/css/custom-theme/jquery-ui-1.8.23.custom.css" />
<script language="javascript" type="text/javascript" src="../lib/jqueryui/js/jquery-1.8.0.min.js"></script>
<script language="javascript" type="text/javascript" src="../lib/jqueryui/js/jquery-ui-1.8.23.custom.min.js"></script>

<script type="text/javascript" src="../lib/jstree/lib/jquery.cookie.js"></script>
<script type="text/javascript" src="../lib/jstree/lib/jquery.hotkeys.js"></script>
<script type="text/javascript" src="../lib/jstree/jquery.jstree.js"></script>
</head>

<body>
<div id="mywin">
<table width="100%">
<tr height="500px">
<td id="mustresize" class="ui-widget-content" valign="top"  style="margin:0;" width="200px">
<h3 class="ui-widget-header">Chủng loại</h3>
<div id="demo1">
</div>
<input type="text" id="clsearch" value="" />
</td>
<td class="ui-widget-content" valign="top" style="margin:0;"><h3 class="ui-widget-header">Chủng loại</h3></td>
</tr>
</table>
</div>
<script language="javascript" type="text/javascript">
	$(document).ready(function(e) {
        $("#demo1").jstree({
			"plugins" : ["themes","xml_data","ui","crrm","hotkeys","contextmenu"],
			"contextmenu": {
				items: function(node){
					return {
						"create":{
							"label":"Tạo chủng loại",
							"icon":false,
							"action":function(){alert('OK !');}
						},
						"fuckoff":{
							"label":"Xóa chủng loại",
							"icon":false,
							"action":function(){alert('OK !');}
						},
						"quit":{
							"label":"Thoát",
							"icon":false,
							"action":function(){}
						}
					} //return item
				}//items
			},//contextmenu
			"xml_data":{
				"ajax":{
					"url":"../modules/chungloai/jstree.php",
					"data":function(n)
					{
						return {
							 "id":n.attr ? n.attr("id"): ""
						};
					}
				},//ajax
				"xsl":"flat"
			}// xml_data
		});
		$("#mustresize").resizable({minHeight:500,maxHeight:500,minWidth:200});
		$("#mywin").dialog({
			title:"Danh mục chủng loại và sản phẩm",
			position:["top","right"],
			width:800,height:600,
			draggable: true
		});
    });
</script>
</body>
</html>